/**
 * The MIT License
 *
 * Copyright (c) 2010 Benjamin Klum
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package org.helgoboss.scala_logging_slf4j

import org.slf4j.{Logger, LoggerFactory}

trait Slf4jLogging {
    private val log = LoggerFactory.getLogger(getClass)

    def trace(message:String, values:Any*) = log.trace(message, values.map(_.asInstanceOf[Object]).toArray)
    def trace(message:String, error:Throwable) = log.trace(message, error)
    def trace(message:String, error:Throwable, values:Any*) = log.trace(message, error, values.map(_.asInstanceOf[Object]).toArray)

    def debug(message:String, values:Any*) = log.debug(message, values.map(_.asInstanceOf[Object]).toArray)
    def debug(message:String, error:Throwable) = log.debug(message, error)
    def debug(message:String, error:Throwable, values:Any*) = log.debug(message, error, values.map(_.asInstanceOf[Object]).toArray)

    def info(message:String, values:Any*) = log.info(message, values.map(_.asInstanceOf[Object]).toArray)
    def info(message:String, error:Throwable) = log.info(message, error)
    def info(message:String, error:Throwable, values:Any*) = log.info(message, error, values.map(_.asInstanceOf[Object]).toArray)

    def warn(message:String, values:Any*) = log.warn(message, values.map(_.asInstanceOf[Object]).toArray)
    def warn(message:String, error:Throwable) = log.warn(message, error)
    def warn(message:String, error:Throwable, values:Any*) = log.warn(message, error, values.map(_.asInstanceOf[Object]).toArray)

    def error(message:String, values:Any*) = log.error(message, values.map(_.asInstanceOf[Object]).toArray)
    def error(message:String, error:Throwable) = log.error(message, error)
    def error(message:String, error:Throwable, values:Any*) = log.error(message, error, values.map(_.asInstanceOf[Object]).toArray)
}
